import React, { Component } from "react";
// import qs from 'querystring'
export default class Detail extends Component {
  state = {
    message: [
      { id: "1", context: "我是内容1" },
      { id: "2", context: "我是内容2" },
      { id: "3", context: "我是内容3" },
    ],
  };
  render() {
    const { message } = this.state;
    // const { id, title } = this.props.match.params;

    const { id, title } = this.props.location.state||{};
    const findContext =
      message.find((msg) => {
        return msg.id === id;
      }) || {};
    return (
      <ul>
        <li>ID:{id}</li>
        <li>TITLE:{title}</li>
        <li>CONTEXT:{findContext.context}</li>
      </ul>
    );
  }
}
